class WeChatResponse {
  int code = 0;
  String msg = "";
  WeChatResult? result;

  WeChatResponse.formJson(Map<String, dynamic>? jsonMap) {
    if (jsonMap?.isNotEmpty ?? false) {
      code = jsonMap?['code'];
      msg = jsonMap?['msg'];
      if (jsonMap?['result'] != null) {
        var resultMap = jsonMap?['result'];
        result = WeChatResult.formJson(resultMap);
      }
    } else {
      code = -20000;
      msg = "解析数据失败";
    }
  }
}

class WeChatResult {
  int curpage = 0;
  int allnum = 0;
  List<WeChatNews> list = []; // 提供默认值

  WeChatResult.formJson(Map<String, dynamic> json) {
    curpage = json['curpage'];
    allnum = json['allnum'];
    if (json['list'] != null) {
      json['list'].forEach((v) {
        list.add(WeChatNews.formJson(v));
      });
    }
  }
}

class WeChatNews {
  String ctime = "";
  String title = "";
  String description = "";
  String picurl = "";
  String url = "";

  WeChatNews.formJson(Map<String, dynamic> json) {
    ctime = json['ctime'];
    title = json['title'];
    description = json['description'];
    picurl = json['picurl'];
    url = json['url'];
  }
}
